home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / AECUR100.ARJ / WINSCH.C < prev    next >
C/C++ Source or Header  |  1990-03-08  |  780b  |  35 lines

  1. /*------------------------------------------------------------
  2.  * 
  3.  *  winsch.c
  4.  * 
  5.  *  copyright (c) 1987,88,89,90 J. Alan Eldridge
  6.  *
  7.  *  inserts a char at the cursor position in a window
  8.  *  rightmost char on line falls off
  9.  * 
  10.  *----------------------------------------------------------*/
  11.  
  12. #include "curses.h"
  13.  
  14. int
  15. winsch(win, ch)
  16. WINDOW  *win;
  17. int     ch;
  18. {
  19.     int cury, curx, cnt;
  20.     VIDCHR *ptr;
  21.  
  22.     getyx(win, cury, curx);
  23.     cnt = win->maxx - curx;
  24.     markwin(win);
  25.     ptr = &(win->buf[cury][curx + cnt]);
  26.     memcpy(ptr + 1, ptr, cnt * sizeof(VIDCHR));
  27.     win->buf[cury][curx].chr = ch;
  28.     win->buf[cury][curx].att = win->attrib;
  29.     wmove(win, cury, win->maxx);
  30.     markwin(win);
  31.     wmove(win, cury, curx);
  32.  
  33.     return OK;
  34. }
  35.